﻿@model RiderShop.Mobile.Modle.MyAccount.MyPromotionCodeModel

@if (Model.PromotionCodeList == null || Model.PromotionCodeList.Count == 0)
{
    <div class="box">
        <div id="empty" style="text-align: center">
            <p>@Html.Raw("暂无优惠券")</p>
            <div class="btn btn-default">
                <a href="/Home" class="empty_go_main">去逛逛</a>
            </div>
        </div>
    </div>
}
else
{
    foreach (var promotionCode in Model.PromotionCodeList)
    {
        <div class="promotionCodeItem">
            <div class="promotionCodeBody">
                @if (promotionCode.PromotionType == 1)
                {
                    <img style="margin-top:15px;" src="~/Themes/RongJi/Style/base/imgs/promotion/hongbao.jpg" />
                }
                else
                {
                    if (promotionCode.LimitRegionType == Kevin.Shop.Business.Service.Entity.SalesManagement.PromotionCode.PromotionRegionType.ProductLimited)
                    {
                        <img style="margin-top:15px;" src="~/Themes/RongJi/Style/base/imgs/promotion/zhuanxiang.png" />
                    }
                    else
                    {
                        if (promotionCode.LimitAmountType == Kevin.Shop.Business.Service.Entity.SalesManagement.PromotionCode.PromotionLimitAmountType.AmountLimited)
                        {
                            <img style="margin-top:15px;" src="~/Themes/RongJi/Style/base/imgs/promotion/manjian.png" />
                        }
                        else
                        {
                            <img style="margin-top:15px;" src="~/Themes/RongJi/Style/base/imgs/promotion/tongyong.png" />
                        }
                    }
                }
                @*<span class="bianhao">No. @promotionCode.PromotionCode
                    </span>
                    <span class="mianzhi">￥@promotionCode.Discount.ToString("F0")<em>元</em></span>
                    @if (@promotionCode.PromotionType == 0)
                    {
                        <span class="tiaojian">订单满 ￥@promotionCode.Amount.ToString("F0") 可使用</span>
                    }
                    else if (@promotionCode.PromotionType == 1)
                    {
                        <span class="tiaojian">@Html.Raw("没有消费金额限制")</span>
                    }
                    <span class="type">
                        @if (@promotionCode.PromotionType == 0)
                        {
                            @Html.Raw("优惠券")
                        }
                        else if (@promotionCode.PromotionType == 1)
                        {
                            @Html.Raw("代金券")
                        }
                    </span>*@
            </div>
            <div class="promotionCodeDate">
                <p style="font-size:20px;margin-bottom:5px;"><strong>@(promotionCode.CouponName + (promotionCode.PromotionType == 1 ? (" - " + promotionCode.CodeDiscount.ToString("F0") + "元") : "")) </strong></p>
                <p style="font-size:16px;margin-bottom:5px;">@promotionCode.Description</p>
                <p>领取时间：</p><p>@promotionCode.ReceiveDate.ToString("yyyy.MM.dd")</p>
                @if (Model.Status == 1)
                {
                    <p>使用时间：</p><p>@promotionCode.UseDate</p>
                    <p>订单号：</p><p><a href="/MyAccount/OrderDetail?orderNumber=@promotionCode.OrderNumber">@promotionCode.OrderNumber</a></p>
                }
                <p>有 效 期： </p><p style="color:red">@(promotionCode.UseStartTime.ToString("yyyy.MM.dd"))  @Html.Raw("~")  @promotionCode.ExpirationTime.ToString("yyyy.MM.dd")</p>
                <h6><strong>适用范围</strong></h6>
                @if (promotionCode.PromotionCodeItemList != null && promotionCode.PromotionCodeItemList.Count > 0)
                {
                    foreach (var item in promotionCode.PromotionCodeItemList)
                    {
                        <ul class="ProductsList">
                            @if (!string.IsNullOrEmpty(@item.ProductId) && @item.UsableType == 1)
                            {
                                <li>
                                    @Html.Raw("【商品限制】")<a href="~/Product/ProductDetail?prd=@item.ProductId" target="_blank">@item.ProductName</a>
                                </li>
                            }
                            else if ((@item.ManufactoryId != null && @item.ManufactoryId != 0) && (@item.CategoryId != null && @item.CategoryId != 0) && @item.UsableType == 2)
                            {
                                <li>
                                    @Html.Raw("【品牌+类别限制】")@item.ManufactoryName@Html.Raw("品牌-")
                                    <a href="~/Product/ProductList?sid=@item.CategoryId" target="_blank">@item.CategoryName@Html.Raw("类")</a>
                                </li>
                            }
                            else if ((@item.CategoryId != null && @item.CategoryId != 0) && (@item.ManufactoryId == null || @item.ManufactoryId == 0) && @item.UsableType == 4)
                            {
                                <li>
                                    @Html.Raw("【类别限制】")<a href="~/Product/ProductList?sid=@item.CategoryId" target="_blank">@item.CategoryName@Html.Raw("类")</a>
                                </li>
                            }
                            else if ((@item.ManufactoryId != null && @item.ManufactoryId != 0) && (@item.CategoryId == null || @item.CategoryId == 0) && @item.UsableType == 3)
                            {
                                <li>
                                    @Html.Raw("【品牌限制】")@item.ManufactoryName
                                </li>
                            }
                        </ul>
                    }
                }
                else
                {
                    @Html.Raw("全站通用（特价与秒杀除外）")
                }
            </div>
            <br class="clearfix">
        </div>
    }
}